Optimizing apply and lambda function with pandas

welcome to shbcf.ru